﻿using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
/*
    File name:          ColorConverter
    File type:          class
    Author:             Mads Skipper Pedersen 07299
    Creation date:      29-03-2011
    Last modified:      29-03-2011
    Last modified by:   Mads Skipper Pedersen 07299
    Description:        Converts the logtype to a color that can be displayed
*/

using System;

namespace TechLog.Util  

{
    [ValueConversion(typeof(int), typeof(SolidColorBrush))]
    class ColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            switch ((int)value)
            {
                case 1:
                    return new SolidColorBrush(Colors.Blue);;
                case 2:
                    return new SolidColorBrush(Colors.White);
                case 3:
                    return new SolidColorBrush(Colors.Red);
                case 4:
                    return new SolidColorBrush(Colors.Yellow);
                case 5:
                    return new SolidColorBrush(Colors.Green);
                default:
                    return new SolidColorBrush(Colors.Pink);
            }
        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return 1;
        }
    }
}
